package cn.iocoder.yudao.module.erp.dal.mysql.dpwest;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpwestlist.vo.DpWestListPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.dplist.DpWestListDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 总西线清单 Mapper
 * @author 天使管理员
 */
@Mapper
public interface DpWestListMapper extends BaseMapperX<DpWestListDO> {

    default PageResult<DpWestListDO> selectPage(DpWestListPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DpWestListDO>()
                .eqIfPresent(DpWestListDO::getNo, reqVO.getNo())
                .eqIfPresent(DpWestListDO::getItemNo, reqVO.getItemNo())
                .likeIfPresent(DpWestListDO::getProductName, reqVO.getProductName())
                .eqIfPresent(DpWestListDO::getProductNameRu, reqVO.getProductNameRu())
                .eqIfPresent(DpWestListDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(DpWestListDO::getTotal, reqVO.getTotal())
                .eqIfPresent(DpWestListDO::getWeight, reqVO.getWeight())
                .eqIfPresent(DpWestListDO::getVolume, reqVO.getVolume())
                .eqIfPresent(DpWestListDO::getPicture, reqVO.getPicture())
                .eqIfPresent(DpWestListDO::getTaxRefundStatus, reqVO.getTaxRefundStatus())
                .orderByDesc(DpWestListDO::getId));
    }

    default List<DpWestListDO> selectListByNo(String no) {
        return selectList(DpWestListDO::getNo, no);
    }

    default int deleteByNo(String no) {
        return delete(DpWestListDO::getNo, no);
    }

}